--[[ 编码: WMS-01-17 名称: 容器-禁用启用 作者:HAN 日期:2025-01-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: Enable 功能: 如果容器是启用状态设置为禁用,如果是禁用设置为启用 更改记录: --]] wms_cntr = require( "wms_container" ) function Enable ( strLuaDEID ) local nRet, strRetInfo -- step1 获取当前点中的任务 nRet, objs = m3.GetSysDataJson( strLuaDEID ) if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), objs ) end -- [{"id":"","attrs":[{"attr":"","value":""},..]},..] local nCount = #objs if (nCount == 0) then return end local obj_attrs = m3.KeyValueAttrsToObjAttr(objs[1].attrs) local cntr nRet, cntr = wms_cntr.GetInfo( strLuaDEID, obj_attrs.S_CODE ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取容器'"..cntr.code.."'信息失败!"..strRetInfo ) end local strUpdateSql if ( cntr.enable == 'Y' ) then -- 禁用 strUpdateSql = "C_ENABLE = 'N'" else -- 启用 strUpdateSql = "C_ENABLE = 'Y'" end local strCondition = "S_CODE = '"..obj_attrs.S_CODE.."'" nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Container", strCondition, strUpdateSql ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【容器】信息失败!"..strRetInfo ) end local action = { { action_type = "refresh_cur_row", value = "" } } nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action)) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end end